package com.rockcent.third;

import com.rockcent.common.common.RWebMvcConfigurerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * Created by oyhk on 15-2-15.
 */
@Configuration
@EnableWebMvc
public class WebMvcConfig extends RWebMvcConfigurerAdapter {

    @Autowired
    private LoginUserInterceptor loginUserInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        super.addInterceptors(registry);
        registry.addInterceptor(loginUserInterceptor).addPathPatterns((String[]) loginUserInterceptor.getPathPatterns().toArray(new String[]{}));
    }

}
